Object-oriented programming languages, such as C++ and Java, share several common properties. Generally, they support "encapsulation", or the binding of functions and data structures. Encapsulation allows the creation of classes which combine data members and member functions. For example, a user can define a class Circle:
class Circle { int x; int y; int radius; void DrawCircle ( ); };
The data members of the class Circle are x, y, and radius. The member function of the class is DrawCircle ( ).
"Inheritance" is the second property shared by object-oriented programming languages. Inheritance allows a user to define a derived class which inherits the data and function members of one or more previously defined classes. For example, a class ShadedCircle can be defined to inherit from previously defined class Circle:
 class ShadedCircle : Circle { int Colour; void ShadeCircle ( ); };
Class ShadedCircle inherits the data and function members from Circle and introduces new data member Colour, and new function member ShadeCircle. A hierarchy of classes can be developed, each deriving data and function members from previously defined classes. If a class derives data and function members from more than one class in a hierarchy, it is an example of multiple inheritance.
The final property shared by true object-oriented programming languages is "polymorphism", or late binding. Polymorphism allows a function or operator to be shared up and down a class hierarchy, with each class in the hierarchy implementing the function or operator in a manner appropriate to itself. In C++, polymorphism is accomplished by declaring a function "virtual". A virtual function can be overridden by a function of the same name and type in a derived class. For example, the function DrawCircle is declared to be virtual in classes Circle and ShadedCircle:
 class Circle { int x; int y; int radius; virtual void DrawCircle( ); }; class ShadedCircle : Circle { int Colour; virtual void DrawCircle( ); };
If objects a and b are defined to be objects of type class Circle and type class ShadedCircle, respectively:
Circle a; PA1 ShadedCircle b; then the statement: PA1 a.DrawCircle ( ) refers to the function DrawCircle as defined in class Circle; and PA1 b.DrawCircle ( ) refers to the function DrawCircle as defined in class ShadedCircle. PA1 (i) determining the inherited virtual functions in said at least one class for which an address adjustment value would be stored in a virtual function table; PA1 (ii) constructing said virtual function table for said at least one class, said virtual function table comprising an entry for each inherited virtual function, and for any new virtual function introduced in said at least one class, wherein each entry for each said determined inherited virtual function includes an address adjustment value, and wherein each entry for each remaining inherited virtual function and for each new virtual function comprises an address pointer representing one of the location of an address adjustment program and an address of said function. PA1 (i) determining inherited virtual functions in said at least one class for which an address adjustment value would be stored in a virtual function table; PA1 (ii) determining a location of an entry for said virtual function in a virtual function table, said virtual function table comprising an entry for each inherited virtual function and for any new virtual function introduced in said at least one class, wherein each entry for each said determined inherited virtual function includes an address pointer to said inherited virtual function and an address adjustment value, and wherein each entry for each remaining inherited virtual function and for each new function comprises an address pointer representing one of the location of an address adjustment program and an address of said function; PA1 (iii) employing said entry to operably construct a call to said virtual function. PA1 (i) accessing the virtual function table for said virtual function; PA1 (ii) performing an address adjustment when an entry for the virtual function table contains an address adjustment value; and PA1 (iii) transferring execution of the program to the address indicated by the address pointer contained in said entry. PA1 computer-readable program code means for determining the inherited virtual functions from said at least one class for which an address adjustment value would be stored in a virtual function table; and PA1 computer readable program code means for constructing said virtual function table for said at least one class, said virtual function table comprising an entry for each inherited virtual function and for any new virtual function introduced in said at least one class, wherein each entry for each said determined inherited virtual function includes an address adjustment value, and wherein each entry for each remaining inherited virtual function and for each new virtual function comprises an address pointer representing one of the location of an address adjustment program and an address of said function. PA1 a computer usable medium having computer readable program code means embodied in said medium for determining the inherited virtual functions from said at least one class for which an address adjustment value would be stored in a virtual function table; and PA1 a computer usable medium having computer readable program code means embodied in said medium for constructing said virtual function table for said at least one class, said virtual function table comprising an entry for each inherited virtual function and for any new virtual function introduced in said at least one class, wherein each entry for each said determined inherited virtual function includes an address adjustment value, and wherein each entry for each remaining inherited virtual function and for each new virtual function comprises an address pointer representing one of the location of an address adjustment program and an address of said function. PA1 a general purpose computer for executing said object-oriented program; PA1 means for determining the inherited virtual functions from said at least one class for which an address adjustment value would be stored therefor in a virtual function table; PA1 means for constructing said virtual function table for said at least one class, said virtual function table comprising an entry for each inherited virtual function and for any new virtual function introduced in said at least one class, wherein each entry for each said determined inherited virtual function includes an address adjustment value, and wherein each entry for each remaining inherited virtual function and for each new function comprises an address pointer representing one of the location of an address adjustment program and an address of said function.
Encapsulation, inheritance and polymorphism allow the development of modular, maintainable and portable code. Ideally, classes and functions developed for one application can be re-used in subsequent applications.
A virtual function table ("VFT") is a compiler-created data structure used to support virtual function dispatch in object-oriented application programs. The VFT provides a technique to implement the two aspects of calling a virtual function at run time: which function to call, and how to adjust the value of a "this" pointer, as described below. Under an implementation commonly employed in early C++ compilers, each class having access to a virtual function member has an associated VFT which lists the addresses of each virtual function, in order of declaration, and an adjustment to the this pointer. Each object in a class contains a pointer to the VFT. The pointer to the VFT is initialized with the address of the associated virtual function table when the object is instantiated. To invoke a virtual function, the compiler generates code which accesses the virtual function member through the VFT.
Generally, a derived class inherits a copy of the VFT(s) associated with its base classes. A derived class that introduces a virtual function member has its own VFT which can include the entries from inherited VFT's from its base classes and entries for any newly introduced virtual functions.
For example, if derived class ShadedCircle introduces a new virtual function StretchCircle( ):
 class ShadedCircle : Circle { int Color; virtual void DrawCircle( ); virtual void StretchCircle( ); };
the associated VFT for class Circle would be:
 &Circle :: DrawCircle( ) 0
where &Circle :: DrawCircle( ) is the address of virtual function DrawCircle( ) for class Circle and the adjustment to the this pointer is zero. Class ShadedCircle would inherit the VFT for DrawCircle( ) from class Circle, and would construct a VFT for virtual function StretchCircle( ), resulting in two VFT's, the first containing the address to virtual function DrawCircle( ) and a zero adjustment to the this pointer, the second containing the address of virtual function StretchCircle( ) and an adjustment to the this pointer, again zero in this example:
 &ShadedCircle :: DrawCircle( ) 0 &ShadedCircle :: StretchCircle( ) 0
In C++, the this pointer points to the object for which a function is called. Generally, the this pointer is passed to the function as a hidden argument. The this pointer in the case of a call can assume two values. When called, the this pointer is set to point within the object to the base class where it was introduced. The this pointer is the address of the occurrence of the introducing class in the object associated with the call. When a function is overridden, the overriding function must adjust the this pointer by the offset between the address of the object and the address of the occurrence of the introducing class within the object. The adjustment, commonly known as a "this adjustment", permits the overriding function to access the entire object of the class in which it was declared.
As discussed above, for reasons of backward compatibility, for example CFRONT.TM. compatibility, many compilers employ VFT's which contain a virtual function address and a this pointer adjustment for each virtual function inherited or introduced by a class. Calling a virtual function through a VFT constructed in such a manner has two significant drawbacks. First, adjustment of the this pointer occurs for every call, even when the required adjustment is zero. Secondly, even when the adjustment is zero, the space for an adjustment is reserved in the table, making the tables potentially quite large. Examination of typical C++ programs shows that the majority of adjustments are, in fact, zero, such as in cases of single inheritance and for classes on the left leg of a multiple inheritance hierarchy, as discussed below in greater detail. As a result, the code for calling a virtual function is larger and slower than may otherwise be necessary.
A more efficient VFT structure and method was subsequently, developed, employing an adjustor routine, commonly known as a "thunk". The term "thunk" is a common term in the art to denote the activities that take place in moving from one environment to another in a mixed environment program in the case described here, each VFT entry contains one pointer, if there is a non-zero adjustment required, then the pointer is the address of a thunk that adjusts the this pointer and then jumps to the function to be called. The advantages of the adjustor thunk implementation for calling virtual functions are that the cost of the this adjustment, in terms of both time and memory requirements, is only paid when a non-zero adjustment is required, and each entry for a virtual function in its associated VFT's contains only one member, either the address of the function or the address of a thunk for a function having a non-zero this pointer adjustment. This results in shorter, faster code and VFT's which are half the size as in the first method described above.
However, there are still problems associated with the prior art VFT structures and virtual function call methods. For example, the VFT's for virtual functions compiled by compilers using the first method are not compatible with the VFT's for virtual functions compiled by compilers implementing the adjustor thunk method. In order to use the more efficient adjustor thunk implementation, all code, including the libraries, etc., compiled by a compiler using the first method would have to be recompiled and retested, a costly, time consuming and undesirable solution for both software developers and users.
As a result, existing compiler developers must choose between developing compilers which break backwards compatibility and compilers which produce uncompetitively slow and/or large code when compared to compilers using the adjustor thunk implementation. Alternatively, compilers could support a command line option to generate VFT's employing either the first or adjustor thunk method. However, to support both VFT layouts, the compiler would have to be bundled with, and choose between, two complete sets of class libraries, one for each layout. Moreover, cross-inheritance and third party libraries cannot be supported. In addition, if one base class in the hierarchy cannot be recompiled because, for example, it is from a binary class library or framework, then all the classes in the hierarchy must use the layout of that base class. If there were two base classes with differing layouts then multiple inheritance of both these classes can not be supported.